package com.arelikebrothers.demo.spring.ioc.life;

import lombok.Data;
import lombok.ToString;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.*;

/**
 * Created by lennon on 24/05/2017.
 * AbstractAutowireCapableBeanFactory
 */
@ToString
@Data
public class Car implements BeanFactoryAware, BeanNameAware, InitializingBean, DisposableBean{

    private String brand;
    private String color;
    private int maxSpeed;

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("setBeanFactory " + beanFactory.getClass().getCanonicalName());
    }

    @Override
    public void setBeanName(String s) {
        System.out.println("setBeanName " + s);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("destroy");
    }

    public Car() {
        System.out.println("构造函数");
    }
}
